// -----------------------------------------------------------------------------------------
//                     Support script for TreeGrid MS Excel sheet example
// -----------------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------------
// Called after resized any row by a user
TGSetEvent("OnRowResize","Excel",function(G,row,height,oheight){
if(row.id=="OUT"){ // Resized the OUT row
   if(height<26) height = 26;    // Minimal height of the row is set as 26
   row.MaxHeight = height-13;    // Sets MaxHeight to not resize the EDIT cell due its content. The 13 is top + bottom padding of the cell.
   row.EDITHeight = height-13;   // Sets minimal height of the EDIT cell. The 13 is top + bottom padding of the cell.
   return height;
   }
});
// ------------------------------------------------------------------------------------------------------------
// Called when NoVScroll / NoHScroll is set / unset automatically due small window size or manually by click to Toolbar WinScroll button
// clr is set if the NoVScroll / NoHScroll is being unset
function UpdatePageScroll(G,clr){
document.body.style.margin = clr ? "" : "0px";
G.Rows.Tabber.Space = clr ? 4 : "0";
G.SetMaxHeight(clr);
setTimeout( function(){ G.Render(); },10);
}
TGSetEvent("OnLimitScroll","Excel",UpdatePageScroll); 
TGSetEvent("OnChangeWinScroll","Excel",UpdatePageScroll); 
// -----------------------------------------------------------------------------------------

